﻿using System;
using System.Collections.Generic;
using System.Web.Mvc;
using VideoSeller.Business.Data;
using VideoSeller.Business.Models;
using VideoSeller.Web.Models;

namespace VideoSeller.Web.Controllers
{
	[Authorize]
	public class ClientController : BaseController
    {
		private readonly ClientModel _clientModel;

		public ClientController(ClientModel clientModel)
		{
			_clientModel = clientModel;
		}

		[HttpGet]
		public new ActionResult Profile(Guid id)
		{
			var client = _clientModel.GetClient(id);

			if (client != null)
			{
				var model = new PersonalViewModel();
				model.LoadPersonalData(client, new List<Country>(), id==CurrentClient.UserId);
				return View(model);
			}

			return RedirectToAction("Index", "Home");
		}
    }
}